import Vue from 'vue'
import VueRouter from 'vue-router'
import CheckCar from '@/views/CheckCar'
import InformationEdit from '@/views/InformationEdit'
// 车型
import CarModel from '@/views/CarModel/CarModel'
// 车系
import CarSeries from '@/views/CarModel/CarSeries'
// 品牌
import CarName from '@/views/CarModel/CarName'
// 检测评估结果
import TestingResult from '@/views/TestingResult'
// 评估报告
import EvaluateReport from '@/views/EvaluateReport'
// 历史报价
import HistoryPrice from '@/views/HistoryPrice'
// 精准估价
import AccurateValuation from '@/views/AccurateValuation'
// 签约的检测报告
import EvaliateSecond from '@/views/EvaliateSecond'
// 签约
import Singed from '@/views/Singed'
// 签约有图片
import Singedthrid from '@/views/Singedthrid'
// 车辆检测安全部件
import CarTest from '@/views/CarTest'
// 车辆检测性能部件
import AccessPart from '@/views/AccessPart'
// 损伤拍照
import DamagePictrue from '@/views/DamagePictrue'
// 车辆评估
import AccessImg from '@/views/AccessImg'
// 已检测报告
import TestedResut from '@/views/TestedResult'
Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/checkcar' },
  // { path: '/goodlist', component: GoodsList },
  {
    path: '/checkcar', component: CheckCar
  },
  { path: '/infoedit', component: InformationEdit },
  // 汽车车型的路由
  { path: '/carmodel', component: CarModel },
  // 车系
  { path: '/carseries', component: CarSeries },
  // 车名
  { path: '/carname', component: CarName },
  // 检测评估结果
  { path: '/result', component: TestingResult },
  // 评估报告
  { path: '/evaluate', component: EvaluateReport },
  // 历史报价
  { path: '/historyprice', component: HistoryPrice },
  // 精准估价
  { path: '/accuratevaluation', component: AccurateValuation },
  // 签约的检测报告
  { path: '/signed', component: EvaliateSecond },
  // 签约行信息
  { path: '/signroporte', component: Singed },
  // 签约有图片-成交入库
  { path: '/signpicture', component: Singedthrid },
  // 车辆检测
  { path: '/cartest', component: CarTest },
  { path: '/accesspart', component: AccessPart },
  // 车辆评估拍照
  { path: '/accessimg', component: AccessImg },
  // 损伤拍照
  { path: '/damage', component: DamagePictrue },
  // 已检测生成报告
  { path: '/resulted', component: TestedResut }
  // // 计算机
  // { path: '/compute', component: comput },
  // // 结算
  // { path: '/account', component: account },
  // // 计算机车系
  // { path: '/computeserise', component: Computeserise },
  // // 计算器品牌
  // { path: '/computemodel', component: ComputeModel }

]
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

// 时间过滤器
Vue.filter('dateFormat', function (originVal) {
  const dt = new Date(originVal)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')
  return `${y}-${m}-${d}`
})
const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
